//
//  File.swift
//  casdon_swiftUI
//
//  Created by casdon on 2025/5/8.
//
import SwiftUI

struct CustomAlertView: View {
    let title: String
    let message: String
    let buttons: [AlertButton]

    var body: some View {
        VStack {
            Text(title)
                .font(.system(size: 18, weight: .bold))
                .foregroundColor(AppColors.Gy1)
                .scaledToFit()
                .padding(.top, 24)
                .padding(.horizontal, 24)
            Text(message)
                .font(.system(size: 16))
                .foregroundColor(AppColors.Gy2)
                .padding(.top, 4)
                .padding(.horizontal, 24)
            Divider().padding(.top, 20)
            HStack {
                ForEach(buttons) { button in
                    Button(button.title) {
                        button.action()
                    }
                    .font(.system(size: 16, weight: .bold))
                    .frame(maxWidth: .infinity)
                    .background(Color.white)
                    .foregroundColor(button.titleColor)
                    .cornerRadius(8)
                    .padding()
                }
            }
        }
        .background(Color.white)
        .cornerRadius(12)
        .shadow(radius: 20)
        .padding(40)
    }
}

struct AlertButton: Identifiable {
    let id = UUID()
    let title: String
    let titleColor: Color
    let action: () -> Void
}

